package com.webdemo9.contrller;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.webdemo9.bean.UsersBean;
import com.webdemo9.dao.UsersDao;
import com.webdemo9.dao.impl.UsersDaoFactory;
/**
 * 将需要更新的用户信息放入更新页面
 * @author lovemanai
 *
 */
public class UpdateUser extends HttpServlet {

	private UsersDao usersDao = UsersDaoFactory.getUsersDao();
	
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String characterEncoding = this.getServletContext().getInitParameter("characterEncoding").toString();
		request.setCharacterEncoding(characterEncoding);
		String username = request.getParameter("username");
		UsersBean ub = usersDao.search(username);
		request.setAttribute("ub", ub);
		RequestDispatcher rd = request.getRequestDispatcher("update.jsp");
		rd.forward(request, response);
	}


}
